package com.csproj.system.repository.impl;

import java.util.Map;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;


import com.csproj.system.domain.Dictionary;
import com.csproj.system.repository.custom.DictionaryRepositoryCustom;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;


public class DictionaryRepositoryImpl implements DictionaryRepositoryCustom {

	@PersistenceContext
	private EntityManager em;
	
	public EntityManager getEm() {
		return em;
	}

	/**
	 * 字典分页查询分页查询方法
	 * @param hsql			sql语句
	 * @param queryParams	参数
	 * @param pageable		分页对象
	 * @return
	 */
	@Override
	public Page<Dictionary> findPageList(String hsql, Map<String, Object> queryParams, Pageable pageable) {
		//拼hql
		String hql = " from Dictionary dt where dt.deletedFlag = 0 "+hsql;
		//查询
		Page<Dictionary> fieldList = query(hql, pageable, queryParams);
		//返回
		return fieldList;
	}

}
